]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboardManager: Simplify loop
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 24 Oct 2025 13:14:16 +0000 (15:14 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 24 Nov 2025 13:42:59 +0000 (14:42 +0100)
We can iterate over ids directly instead of using an index.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3931>
(cherry picked from commit d1f8c00d2f47d440905a0af3253589cbd0822a3a)

js/misc/keyboardManager.js

index 91041ef7d75c024ec5237a25e9ac9ae901637176..173d2a7c13fb3dd401243402021ba8faa2076660 100644 (file)
@@ -106,10 +106,10 @@ class KeyboardManager {
         this._current = null;
         this._layoutInfos = {};
 
-        for (let i = 0; i < ids.length; ++i) {
-            let [found, , , layout, variant] = this._xkbInfo.get_layout_info(ids[i]);
+        for (const id of ids) {
+            let [found, , , layout, variant] = this._xkbInfo.get_layout_info(id);
             if (found)
-                this._layoutInfos[ids[i]] = {id: ids[i], layout, variant};
+                this._layoutInfos[id] = {id, layout, variant};
         }
 
         let i = 0;